package com.future.lock.common;

import android.app.Application;
import android.text.TextUtils;
import android.widget.TextView;

import com.future.lock.me.entity.bean.LoginBean;
import com.igexin.sdk.PushManager;
import com.mob.MobSDK;

import java.util.List;

/**
 * 项目Application
 * Created by jniu on 2017/11/20.
 */

public class MyApp extends Application{

    private static MyApp instance;
    private static String userToken;
    private static LoginBean userInfo;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        MobSDK.init(this);
        PushManager.getInstance().initialize(this,null);
        PushManager.getInstance().registerPushIntentService(this,GetuiIntentService.class);
    }

    public static MyApp getInstance() {
        return instance;
    }

    public static String getUserToken() {
        return userToken == null?"":userToken;
    }

    public static void setUserToken(String userToken) {
        MyApp.userToken = userToken;
    }

    public static boolean hasLogin(){
        return !TextUtils.isEmpty(userToken);
    }

    public static LoginBean getUserInfo() {
        return userInfo;
    }

    public static void setUserInfo(LoginBean userInfo) {
        MyApp.userInfo = userInfo;
    }
}
